/**
 * 定义接口相关数据结构
 */

/**
 * 节点状态
 */
export enum DagTaskStatusEnum {
  NOT_START = 0,
  WAIT = 1,
  RUN = 2,
  FAIL = -1,
  FINISH = 999
}

/**
 * 节点注册状态
 */
export enum DagTaskRegisterStatusEnum {
  NOT_REGISTER = 0,
  REGISTER = 1
}

/**
 * 边数据结构
 */
export interface DagTaskEdgeInterface {
  createTime: string
  dagId: number
  id: number
  isDelete: boolean
  nextTaskId: number
  taskId: number
}

/**
 * 角数据结构
 */
export interface DagTaskVertexInterface {
  createTime: string
  dagId: number
  dagName: string
  id: number
  isDelete: boolean
  taskId: number
  taskName: string
}

/**
 * 任务数据结构
 */

export interface DagTaskInterface {
  dagId: number
  dagName: string
  postTasks: Array<DagTaskInterface>
  status: DagTaskStatusEnum
  taskExecutionId: string
  taskId: number
  taskName: string
}

/**
 * ----------------------------------- statistic/scheduler/getDag 接口 -----------------------------------
 */
// 请求参数
export interface ApiGetDagResponseEntity {
  token: string
  dagName: string
}

// 成功响应结果
export interface ApiGetDagSuccessResponseDto {
  allDagTaskEdges: Array<DagTaskEdgeInterface>
  allDagTaskVertexes: Array<DagTaskVertexInterface>
  dagName: string
  firstDagTask: DagTaskInterface
}

// 失败响应结果
export interface ApiGetDagErrorResponseDto {
  code: number
  message: string
  msg: string
}

/**
 * ----------------------------------- statistic/scheduler/listLatestTaskHistory 接口 -----------------------------------
 */

export interface ApiGetDagExecutionHistoryItem {
  dagExecutionId: string
  dagId: number
  endTime: string
  startTime: string
}

/**
 * ----------------------------------- statistic/scheduler/listLatestTaskHistory 接口 -----------------------------------
 */

export interface ApiGetLatestTaskHistoryItem {
  createTime: string
  dagExecutionId: string
  dagId: number
  id: number
  status: DagTaskStatusEnum
  taskExecutionId: string
  taskId: number
}

/**
 * ----------------------------------- statistic/logback/readDagLog 接口 -----------------------------------
 */

export type ApiGetDagLogSuccess = Array<string>

export interface ApiGetDagLogError {
  code: string
  msg: string
  result: boolean
}

/**
 * ----------------------------------- statistic/scheduler/getRegisterXxlJobList 接口 -----------------------------------
 */
export interface ApiGetRegisterXxlJobListResponse {
  data: Array<string>
  result: boolean
  msg: string
}
